import request from '@/utils/request';
// 关于目录的接口

// 目录详情
export const getDirectoryDetails = id => {
    return request({
        method: 'GET',
        url: `/directorys/${id}`
    });
};
// 目录列表
export const getDirectoryList = (page, pagesize) => {
    return request({
        method: 'GET',
        url: '/directorys',
        params: {
            page,
            pagesize
        }
    });
};
// 目录增加
export const addDirectoryList = (subjectID, directoryName) => {
    return request({
        method: 'POST',
        url: '/directorys',
        data: {
            subjectID,
            directoryName,
            key: 'null'
        }
    });
};

// 目录状态
export const StateDirectory = (id, state) => {
    return request({
        method: 'POST',
        url: `/directorys/${id}/${state}`,
        data: {
            id,
            state
        }
    });
};

// 目录删除
export const DeleteDirectory = id => {
    return request({
        method: 'DELETE',
        url: `/directorys/${id}`
    });
};

// 目录修改
export const updateDirectory = (id, subjectID, directoryName) => {
    return request({
        method: 'PUT',
        url: `/directorys/${id}`,
        data: {
            id,
            subjectID,
            directoryName
        }
    });
};
// 实现搜索功能的接口
export const SearchDirectory = (state, directoryName, page, pagesize) => {
    return request({
        method: 'GET',
        url: '/directorys',
        params: {
            state,
            directoryName,
            page,
            pagesize
        }
    });
};